import { connect } from 'react-redux';
import reducer, { getOrderInfo, orderInfo } from '../store/user/order';
import { injectReducer } from '../store/reducers';
import store from '../store/createStore';
import User from '../components/User';

const mapDispatchToProps = { getOrderInfo, orderInfo };

const mapStateToProps = state => ({
  userInfo: state.user.userInfo,
  datasource: state.order.datasource,
  unComment: state.order.unComment,
  unpay: state.order.unpay,
  unTravel: state.order.unTravel
});

injectReducer(store, { key: 'order', reducer });

export default connect(
  mapStateToProps,
  mapDispatchToProps
)(User);
